﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    public class RenQianQueRen
    {
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        private int _PublicOfficialRecordID;
        [DataMember]
        public int PublicOfficialRecordID
        {
            get { return _PublicOfficialRecordID; }
            set { _PublicOfficialRecordID = value; }
        }    

        private string _Duty;
        [DataMember]
        public string Duty
        {
            get { return _Duty; }
            set { _Duty = value; }
        }
        private string _Department_Duty;
        [DataMember]
        public string Department_Duty
        {
            get { return _Department_Duty; }
            set { _Department_Duty = value; }
        }
        

        private string _EmpName;
        [DataMember]
        public string EmpName
        {
            get { return _EmpName; }
            set { _EmpName = value; }
        }
     
        private DateTime? _StartDate;
        [DataMember]
        public DateTime? StartDate
        {
            get { return _StartDate; }
            set { _StartDate = value; }
        }
        private DateTime? _EndDate;
        [DataMember]
        public DateTime? EndDate
        {
            get { return _EndDate; }
            set { _EndDate = value; }
        }
        private int? _SYQ;
        [DataMember]
        public int? SYQ
        {
            get { return _SYQ; }
            set { _SYQ = value; }
        }
        private string _CreateUser;
        [DataMember]
        public string CreateUser
        {
            get { return _CreateUser; }
            set { _CreateUser = value; }
        }

        private DateTime? _CreateDate;
        [DataMember]
        public DateTime? CreateDate
        {
            get { return _CreateDate; }
            set { _CreateDate = value; }
        }

        private bool _IsShenQingZhuanRen;
        [DataMember]
        public bool IsShenQingZhuanRen
        {
            get { return _IsShenQingZhuanRen; }
            set { _IsShenQingZhuanRen = value; }
        }
        private bool _IsZhuanRen;
        [DataMember]
        public bool IsZhuanRen
        {
            get { return _IsZhuanRen; }
            set { _IsZhuanRen = value; }
        }
        private string _DutyAttribute;
        [DataMember]
          public string DutyAttribute
        {
            get { return _DutyAttribute; }
            set { _DutyAttribute = value; }
        }
        private string _DutyLevel;
        [DataMember]
        public string DutyLevel
        {
            get { return _DutyLevel; }
            set { _DutyLevel = value; }
        }
        
        public static RenQianQueRen FillEntity(DataRow dr)
        {
            RenQianQueRen right = new RenQianQueRen();
         
            if (!string.IsNullOrEmpty(dr["ID"].ToString())) right.ID = Convert.ToInt32(dr["ID"]);
            if (!string.IsNullOrEmpty(dr["PublicOfficialRecordID"].ToString())) right.PublicOfficialRecordID = Convert.ToInt32(dr["PublicOfficialRecordID"]);

         
            right.Duty = dr["Duty"] as string;
            right.Department_Duty = dr["Department_Duty"] as string;
            
            right.DutyAttribute = dr["DutyAttribute"] as string;
            right.DutyLevel = dr["DutyLevel"] as string;
            right.EmpName = dr["EmpName"] as string;

            if (dr.Table != null && dr.Table.Columns.Contains("IsShenQingZhuanRen"))
                if (!string.IsNullOrEmpty(dr["IsShenQingZhuanRen"].ToString()))
                    right.IsShenQingZhuanRen = Convert.ToBoolean(dr["IsShenQingZhuanRen"]);
            if (dr.Table != null && dr.Table.Columns.Contains("IsZhuanRen"))
                if (!string.IsNullOrEmpty(dr["IsZhuanRen"].ToString()))
                    right.IsZhuanRen = Convert.ToBoolean(dr["IsZhuanRen"]);
            if (!string.IsNullOrEmpty(dr["StartDate"].ToString()))
                right.StartDate = Convert.ToDateTime(dr["StartDate"]);

            if (!string.IsNullOrEmpty(dr["EndDate"].ToString()))
                right.EndDate = Convert.ToDateTime(dr["EndDate"]);

            if (!string.IsNullOrEmpty(dr["SYQ"].ToString()))
            right.SYQ = Convert.ToInt32(dr["SYQ"]);
          
            return right;
        }
    }
}
